// $ANTLR 3.5.2 /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g 2022-02-19 22:40:27

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

// DO NOT EDIT THIS FILE MANUALLY! It is generated from CommandLine.g

package org.netbeans.modules.java.api.common.project.ui.customizer.vmo.gen;

import java.util.Set;
import java.util.HashSet;
import java.util.List;
import java.util.LinkedList;
import java.util.Arrays;
import java.util.regex.Pattern;
import org.netbeans.modules.java.api.common.project.ui.customizer.vmo.*;


import org.antlr.runtime.*;
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;

import org.antlr.runtime.tree.*;


@SuppressWarnings("all")
public class CommandLineParser extends Parser {
	public static final String[] tokenNames = new String[] {
		"<invalid>", "<EOR>", "<DOWN>", "<UP>", "LETTER", "TEXT", "WS", "'\"'", 
		"'-'", "'='", "'\\''"
	};
	public static final int EOF=-1;
	public static final int T__7=7;
	public static final int T__8=8;
	public static final int T__9=9;
	public static final int T__10=10;
	public static final int LETTER=4;
	public static final int TEXT=5;
	public static final int WS=6;

	// delegates
	public Parser[] getDelegates() {
		return new Parser[] {};
	}

	// delegators


	public CommandLineParser(TokenStream input) {
		this(input, new RecognizerSharedState());
	}
	public CommandLineParser(TokenStream input, RecognizerSharedState state) {
		super(input, state);
	}

	protected TreeAdaptor adaptor = new CommonTreeAdaptor();

	public void setTreeAdaptor(TreeAdaptor adaptor) {
		this.adaptor = adaptor;
	}
	public TreeAdaptor getTreeAdaptor() {
		return adaptor;
	}
	@Override public String[] getTokenNames() { return CommandLineParser.tokenNames; }
	@Override public String getGrammarFileName() { return "/home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g"; }



		private static final String SERVER = "server";
		private static final String CLIENT = "client";
		private static final String ESA = "esa";
		private static final String ESA_LONG = "enablesystemassertions";
		private static final String DSA = "dsa";
		private static final String DSA_LONG = "disablesystemassertions";
		private static final String EA = "ea";
		private static final String EA_LONG = "enableassertions";
		private static final String DA = "da";
		private static final String DA_LONG = "disableassertions";
		private static final String VERBOSE = "verbose";
		private static final String SVERSION = "showversion";
		private static final String HELP = "?";
		private static final String HELP_LONG = "help";
		private static final String X = "X";
		private static final String XINT = "Xint";
		private static final String XBATCH = "Xbatch";
		private static final String XCJNI = "Xcheck";
		private static final String XFUTURE = "Xfuture";
		private static final String XNOCLSGC = "Xnoclassgc";
		private static final String XINCGC = "Xincgc";
		private static final String XPROF = "Xprof";
		private static final String XRS = "Xrs";
		private static final String XSHARE = "Xshare";
		private static final String JRE_SEARCH="jre-restrict-search";
		private static final String JRE_NO_SEARCH="jre-no-restrict-search";
		private static final String SPLASH = "splash";
		private static final String XLOGGC = "Xloggc";
		private static final String JAVAAGENT = "javaagent";
		private static final String AGENTLIB = "agentlib";
		private static final String AGENTPATH = "agentpath";
		private static final String BOOTCP = "Xbootclasspath";
		private static final String BOOTCPAPPEND = "Xbootclasspath/a";
		private static final String BOOTCPPREPEND = "Xbootclasspath/p";
		private static final String VERSION = "version";
		private static final String CLASSPATH = "cp";
		private static final String CLASSPATH_LONG = "classpath";

		private static final Set<String> switchOptions = new HashSet<String>() {
		    {
		    	this.addAll(Arrays.asList(
		    	SERVER,
		    	CLIENT,
		    	ESA,
		    	ESA_LONG,
		    	DSA,
		    	DSA_LONG,
		    	EA,
		    	EA_LONG,
		    	DA,
		    	DA_LONG,
		    	SVERSION,
		    	HELP,
		    	HELP_LONG,
		    	X,
		    	XINT,
		    	XBATCH,
		    	XFUTURE,
		    	XNOCLSGC,
		    	XINCGC,
		    	XPROF,
		    	XRS,
		    	JRE_SEARCH,
		    	JRE_NO_SEARCH));
		    }
		};

		private static final Set<String> paramOptions = new HashSet<String>(){
		    {
		        addAll(Arrays.asList(
		        SPLASH,
		        XLOGGC,
		        JAVAAGENT,
		        AGENTLIB,
		        AGENTPATH,
		        BOOTCP,
		        BOOTCPAPPEND,
		        BOOTCPPREPEND
		        ));
		    }
		};

		private static final Pattern memOptions = Pattern.compile("X(m[sx]|ss)\\d+[gGmMkK]");

		private static boolean isParamOption(final String text) {
			for (String option : paramOptions) {
			    if (text.startsWith(option+':')) {
			    	return true;
			    }
			}
			return false;
		}

		//xxx: Wrong! Should use TreeGrammer and not to populate customizer with custom nodes
		//Should be rewritten but I have no time for this
		public List<JavaVMOption<?>> parse() {
	        Set<JavaVMOption<?>> result = new HashSet<JavaVMOption<?>>();
	        try {
	            vmOptions_return options_return = vmOptions();
	            CommonTree root = options_return.tree;
	            if (root instanceof JavaVMOption<?>) {
	                result.add((JavaVMOption<?>) root);
	            } else if (root != null) {
	                result.addAll((List<JavaVMOption<?>>) (List<?>) root.getChildren());
	            }
	        } catch (RecognitionException e) {
	            e.printStackTrace();
	        }
	        result.addAll(getAllOptions());
	        return new LinkedList<JavaVMOption<?>>(result);
	    }


	    private static enum Kind {
	        SWITCH, D, LOOSEPARAM, EQPARAM, COLUMNPARAM, FOLLOWED
	    }


	    private static class OptionDefinition {
	        private OptionDefinition(String name, Kind kind) {
	            this.kind = kind;
	            this.name = name;
	        }

	        Kind kind;
	        String name;
	    }

	    private static OptionDefinition[] optionsTemplates = {
	            new OptionDefinition("client", Kind.SWITCH),
	            new OptionDefinition("server", Kind.SWITCH),
	            new OptionDefinition("ea", Kind.SWITCH),
	            new OptionDefinition("da", Kind.SWITCH),
	            new OptionDefinition("esa", Kind.SWITCH),
	            new OptionDefinition("dsa", Kind.SWITCH),
	            new OptionDefinition("verbose", Kind.SWITCH),
	            new OptionDefinition("verbose:class", Kind.SWITCH),
	            new OptionDefinition("verbose:jni", Kind.SWITCH),
	            new OptionDefinition("verbose:gc", Kind.SWITCH),
	            new OptionDefinition("version", Kind.SWITCH),
	            new OptionDefinition("version", Kind.COLUMNPARAM),
	            new OptionDefinition("showversion", Kind.SWITCH),
	            new OptionDefinition("Xint", Kind.SWITCH),
	            new OptionDefinition("Xbatch", Kind.SWITCH),
	            new OptionDefinition("Xcheck:jni", Kind.SWITCH),
	            new OptionDefinition("Xfuture", Kind.SWITCH),
	            new OptionDefinition("Xnoclassgc", Kind.SWITCH),
	            new OptionDefinition("Xincgc", Kind.SWITCH),
	            new OptionDefinition("Xprof", Kind.SWITCH),
	            new OptionDefinition("Xrs", Kind.SWITCH),
	            new OptionDefinition("Xshare:off", Kind.SWITCH),
	            new OptionDefinition("Xshare:on", Kind.SWITCH),
	            new OptionDefinition("Xshare:auto", Kind.SWITCH),
	            new OptionDefinition("jre-restrict-search", Kind.SWITCH),
	            new OptionDefinition("jre-no-restrict-search", Kind.SWITCH),
	            new OptionDefinition("Xmx", Kind.FOLLOWED),
	            new OptionDefinition("Xms", Kind.FOLLOWED),
	            new OptionDefinition("Xss", Kind.FOLLOWED),
	            new OptionDefinition("splash", Kind.COLUMNPARAM),
	            new OptionDefinition("javaagent", Kind.COLUMNPARAM),
	            new OptionDefinition("agentlib", Kind.COLUMNPARAM),
	            new OptionDefinition("agentpath", Kind.COLUMNPARAM),
	    };

	    public static List<JavaVMOption<?>> getAllOptions() {
	        List<JavaVMOption<?>> result = new LinkedList<JavaVMOption<?>>();
	        for (OptionDefinition optionsTemplate : optionsTemplates) {
	            result.add(createOption(optionsTemplate));
	        }
	        return result;
	    }

	    private static JavaVMOption<?> createOption(OptionDefinition definition) {
	        switch (definition.kind) {
	            case SWITCH:
	                return new SwitchNode(definition.name);
	            case D:
	                return new UserPropertyNode();
	            case FOLLOWED:
	                return new ParametrizedNode(definition.name, "");
	            case COLUMNPARAM:
	                return new ParametrizedNode(definition.name, ":");
	            case EQPARAM:
	                return new ParametrizedNode(definition.name, "=");
	            case LOOSEPARAM:
	                return new ParametrizedNode(definition.name, " ");
	            default:
	                throw new IllegalArgumentException("Invalid definition.");
	        }
	    }


	public static class vmOptions_return extends ParserRuleReturnScope {
		CommonTree tree;
		@Override
		public CommonTree getTree() { return tree; }
	};


	// $ANTLR start "vmOptions"
	// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:311:1: vmOptions : ( ( WS )? option )* ( WS )? -> ( option )* ;
	public final CommandLineParser.vmOptions_return vmOptions() throws RecognitionException {
		CommandLineParser.vmOptions_return retval = new CommandLineParser.vmOptions_return();
		retval.start = input.LT(1);

		CommonTree root_0 = null;

		Token WS1=null;
		Token WS3=null;
		ParserRuleReturnScope option2 =null;

		CommonTree WS1_tree=null;
		CommonTree WS3_tree=null;
		RewriteRuleTokenStream stream_WS=new RewriteRuleTokenStream(adaptor,"token WS");
		RewriteRuleSubtreeStream stream_option=new RewriteRuleSubtreeStream(adaptor,"rule option");

		try {
			// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:312:2: ( ( ( WS )? option )* ( WS )? -> ( option )* )
			// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:312:4: ( ( WS )? option )* ( WS )?
			{
			// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:312:4: ( ( WS )? option )*
			loop2:
			while (true) {
				int alt2=2;
				int LA2_0 = input.LA(1);
				if ( (LA2_0==WS) ) {
					int LA2_1 = input.LA(2);
					if ( (LA2_1==TEXT||LA2_1==8) ) {
						alt2=1;
					}

				}
				else if ( (LA2_0==TEXT||LA2_0==8) ) {
					alt2=1;
				}

				switch (alt2) {
				case 1 :
					// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:312:5: ( WS )? option
					{
					// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:312:5: ( WS )?
					int alt1=2;
					int LA1_0 = input.LA(1);
					if ( (LA1_0==WS) ) {
						alt1=1;
					}
					switch (alt1) {
						case 1 :
							// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:312:5: WS
							{
							WS1=(Token)match(input,WS,FOLLOW_WS_in_vmOptions77);  
							stream_WS.add(WS1);

							}
							break;

					}

					pushFollow(FOLLOW_option_in_vmOptions79);
					option2=option();
					state._fsp--;

					stream_option.add(option2.getTree());
					}
					break;

				default :
					break loop2;
				}
			}

			// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:312:16: ( WS )?
			int alt3=2;
			int LA3_0 = input.LA(1);
			if ( (LA3_0==WS) ) {
				alt3=1;
			}
			switch (alt3) {
				case 1 :
					// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:312:16: WS
					{
					WS3=(Token)match(input,WS,FOLLOW_WS_in_vmOptions82);  
					stream_WS.add(WS3);

					}
					break;

			}

			// AST REWRITE
			// elements: option
			// token labels: 
			// rule labels: retval
			// token list labels: 
			// rule list labels: 
			// wildcard labels: 
			retval.tree = root_0;
			RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);

			root_0 = (CommonTree)adaptor.nil();
			// 312:20: -> ( option )*
			{
				// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:312:23: ( option )*
				while ( stream_option.hasNext() ) {
					adaptor.addChild(root_0, stream_option.nextTree());
				}
				stream_option.reset();

			}


			retval.tree = root_0;

			}

			retval.stop = input.LT(-1);

			retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
			adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
			retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
		}
		finally {
			// do for sure before leaving
		}
		return retval;
	}
	// $ANTLR end "vmOptions"


	public static class option_return extends ParserRuleReturnScope {
		CommonTree tree;
		@Override
		public CommonTree getTree() { return tree; }
	};


	// $ANTLR start "option"
	// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:314:1: option : ( '-' switchOption -> switchOption | nonSwitchOption -> nonSwitchOption );
	public final CommandLineParser.option_return option() throws RecognitionException {
		CommandLineParser.option_return retval = new CommandLineParser.option_return();
		retval.start = input.LT(1);

		CommonTree root_0 = null;

		Token char_literal4=null;
		ParserRuleReturnScope switchOption5 =null;
		ParserRuleReturnScope nonSwitchOption6 =null;

		CommonTree char_literal4_tree=null;
		RewriteRuleTokenStream stream_8=new RewriteRuleTokenStream(adaptor,"token 8");
		RewriteRuleSubtreeStream stream_switchOption=new RewriteRuleSubtreeStream(adaptor,"rule switchOption");
		RewriteRuleSubtreeStream stream_nonSwitchOption=new RewriteRuleSubtreeStream(adaptor,"rule nonSwitchOption");

		try {
			// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:314:8: ( '-' switchOption -> switchOption | nonSwitchOption -> nonSwitchOption )
			int alt4=2;
			int LA4_0 = input.LA(1);
			if ( (LA4_0==8) ) {
				alt4=1;
			}
			else if ( (LA4_0==TEXT) ) {
				alt4=2;
			}

			else {
				NoViableAltException nvae =
					new NoViableAltException("", 4, 0, input);
				throw nvae;
			}

			switch (alt4) {
				case 1 :
					// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:314:10: '-' switchOption
					{
					char_literal4=(Token)match(input,8,FOLLOW_8_in_option96);  
					stream_8.add(char_literal4);

					pushFollow(FOLLOW_switchOption_in_option98);
					switchOption5=switchOption();
					state._fsp--;

					stream_switchOption.add(switchOption5.getTree());
					// AST REWRITE
					// elements: switchOption
					// token labels: 
					// rule labels: retval
					// token list labels: 
					// rule list labels: 
					// wildcard labels: 
					retval.tree = root_0;
					RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);

					root_0 = (CommonTree)adaptor.nil();
					// 314:27: -> switchOption
					{
						adaptor.addChild(root_0, stream_switchOption.nextTree());
					}


					retval.tree = root_0;

					}
					break;
				case 2 :
					// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:315:3: nonSwitchOption
					{
					pushFollow(FOLLOW_nonSwitchOption_in_option108);
					nonSwitchOption6=nonSwitchOption();
					state._fsp--;

					stream_nonSwitchOption.add(nonSwitchOption6.getTree());
					// AST REWRITE
					// elements: nonSwitchOption
					// token labels: 
					// rule labels: retval
					// token list labels: 
					// rule list labels: 
					// wildcard labels: 
					retval.tree = root_0;
					RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);

					root_0 = (CommonTree)adaptor.nil();
					// 315:20: -> nonSwitchOption
					{
						adaptor.addChild(root_0, stream_nonSwitchOption.nextTree());
					}


					retval.tree = root_0;

					}
					break;

			}
			retval.stop = input.LT(-1);

			retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
			adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
			retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
		}
		finally {
			// do for sure before leaving
		}
		return retval;
	}
	// $ANTLR end "option"


	public static class switchOption_return extends ParserRuleReturnScope {
		CommonTree tree;
		@Override
		public CommonTree getTree() { return tree; }
	};


	// $ANTLR start "switchOption"
	// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:317:1: switchOption : ({...}? =>t= TEXT ->|{...}? =>t= TEXT ->|{...}? =>t= TEXT ->|{...}? =>t= TEXT ->|{...}? =>t= TEXT ->|{...}? =>t= TEXT '=' eText ->|{...}? =>t= TEXT ->|{...}? =>t= TEXT ->|{...}? =>t= TEXT WS eText ->|t= TEXT ->);
	public final CommandLineParser.switchOption_return switchOption() throws RecognitionException {
		CommandLineParser.switchOption_return retval = new CommandLineParser.switchOption_return();
		retval.start = input.LT(1);

		CommonTree root_0 = null;

		Token t=null;
		Token char_literal7=null;
		Token WS9=null;
		ParserRuleReturnScope eText8 =null;
		ParserRuleReturnScope eText10 =null;

		CommonTree t_tree=null;
		CommonTree char_literal7_tree=null;
		CommonTree WS9_tree=null;
		RewriteRuleTokenStream stream_9=new RewriteRuleTokenStream(adaptor,"token 9");
		RewriteRuleTokenStream stream_TEXT=new RewriteRuleTokenStream(adaptor,"token TEXT");
		RewriteRuleTokenStream stream_WS=new RewriteRuleTokenStream(adaptor,"token WS");
		RewriteRuleSubtreeStream stream_eText=new RewriteRuleSubtreeStream(adaptor,"rule eText");


			int index = 0;
			String name = null;
			String value = null;

		try {
			// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:323:2: ({...}? =>t= TEXT ->|{...}? =>t= TEXT ->|{...}? =>t= TEXT ->|{...}? =>t= TEXT ->|{...}? =>t= TEXT ->|{...}? =>t= TEXT '=' eText ->|{...}? =>t= TEXT ->|{...}? =>t= TEXT ->|{...}? =>t= TEXT WS eText ->|t= TEXT ->)
			int alt5=10;
			int LA5_0 = input.LA(1);
			if ( (LA5_0==TEXT) ) {
				int LA5_1 = input.LA(2);
				if ( (LA5_1==9) && ((input.LT(1).getText().charAt(0) == 'D'))) {
					alt5=6;
				}
				else if ( (LA5_1==WS) && ((CLASSPATH.equals(input.LT(1).getText()) || CLASSPATH_LONG.equals(input.LT(1).getText())))) {
					alt5=9;
				}
				else if ( ((switchOptions.contains(input.LT(1).getText()))) ) {
					alt5=1;
				}
				else if ( ((VERBOSE.equals(input.LT(1).getText()) || input.LT(1).getText().startsWith(VERBOSE+':'))) ) {
					alt5=2;
				}
				else if ( ((VERSION.equals(input.LT(1).getText()) || input.LT(1).getText().startsWith(VERSION+':'))) ) {
					alt5=3;
				}
				else if ( ((input.LT(1).getText().startsWith(XSHARE+':'))) ) {
					alt5=4;
				}
				else if ( ((input.LT(1).getText().startsWith(XCJNI+':'))) ) {
					alt5=5;
				}
				else if ( ((isParamOption(input.LT(1).getText()))) ) {
					alt5=7;
				}
				else if ( ((memOptions.matcher(input.LT(1).getText()).matches())) ) {
					alt5=8;
				}
				else if ( (true) ) {
					alt5=10;
				}

			}

			else {
				NoViableAltException nvae =
					new NoViableAltException("", 5, 0, input);
				throw nvae;
			}

			switch (alt5) {
				case 1 :
					// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:323:4: {...}? =>t= TEXT
					{
					if ( !((switchOptions.contains(input.LT(1).getText()))) ) {
						throw new FailedPredicateException(input, "switchOption", "switchOptions.contains(input.LT(1).getText())");
					}
					t=(Token)match(input,TEXT,FOLLOW_TEXT_in_switchOption132);  
					stream_TEXT.add(t);

					// AST REWRITE
					// elements: 
					// token labels: 
					// rule labels: retval
					// token list labels: 
					// rule list labels: 
					// wildcard labels: 
					retval.tree = root_0;
					RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);

					root_0 = (CommonTree)adaptor.nil();
					// 323:78: ->
					{
						adaptor.addChild(root_0, new SwitchNode(t));
					}


					retval.tree = root_0;

					}
					break;
				case 2 :
					// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:324:3: {...}? =>t= TEXT
					{
					if ( !((VERBOSE.equals(input.LT(1).getText()) || input.LT(1).getText().startsWith(VERBOSE+':'))) ) {
						throw new FailedPredicateException(input, "switchOption", "VERBOSE.equals(input.LT(1).getText()) || input.LT(1).getText().startsWith(VERBOSE+':')");
					}
					t=(Token)match(input,TEXT,FOLLOW_TEXT_in_switchOption163);  
					stream_TEXT.add(t);

					// AST REWRITE
					// elements: 
					// token labels: 
					// rule labels: retval
					// token list labels: 
					// rule list labels: 
					// wildcard labels: 
					retval.tree = root_0;
					RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);

					root_0 = (CommonTree)adaptor.nil();
					// 324:107: ->
					{
						adaptor.addChild(root_0, new SwitchNode(t));
					}


					retval.tree = root_0;

					}
					break;
				case 3 :
					// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:325:3: {...}? =>t= TEXT
					{
					if ( !((VERSION.equals(input.LT(1).getText()) || input.LT(1).getText().startsWith(VERSION+':'))) ) {
						throw new FailedPredicateException(input, "switchOption", "VERSION.equals(input.LT(1).getText()) || input.LT(1).getText().startsWith(VERSION+':')");
					}
					t=(Token)match(input,TEXT,FOLLOW_TEXT_in_switchOption183);  
					stream_TEXT.add(t);

					index = t.getText().indexOf(':'); if (index > 0) {name=t.getText().substring(0,index); value = (index+1) == t.getText().length() ? "" : t.getText().substring(index+1);} else {name=t.getText();} 
					// AST REWRITE
					// elements: 
					// token labels: 
					// rule labels: retval
					// token list labels: 
					// rule list labels: 
					// wildcard labels: 
					retval.tree = root_0;
					RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);

					root_0 = (CommonTree)adaptor.nil();
					// 325:304: ->
					{
						adaptor.addChild(root_0,  index < 0 ? new SwitchNode(t) : new ParametrizedNode(t, name, ":", value));
					}


					retval.tree = root_0;

					}
					break;
				case 4 :
					// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:326:3: {...}? =>t= TEXT
					{
					if ( !((input.LT(1).getText().startsWith(XSHARE+':'))) ) {
						throw new FailedPredicateException(input, "switchOption", "input.LT(1).getText().startsWith(XSHARE+':')");
					}
					t=(Token)match(input,TEXT,FOLLOW_TEXT_in_switchOption200);  
					stream_TEXT.add(t);

					// AST REWRITE
					// elements: 
					// token labels: 
					// rule labels: retval
					// token list labels: 
					// rule list labels: 
					// wildcard labels: 
					retval.tree = root_0;
					RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);

					root_0 = (CommonTree)adaptor.nil();
					// 326:60: ->
					{
						adaptor.addChild(root_0, new SwitchNode(t));
					}


					retval.tree = root_0;

					}
					break;
				case 5 :
					// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:327:3: {...}? =>t= TEXT
					{
					if ( !((input.LT(1).getText().startsWith(XCJNI+':'))) ) {
						throw new FailedPredicateException(input, "switchOption", "input.LT(1).getText().startsWith(XCJNI+':')");
					}
					t=(Token)match(input,TEXT,FOLLOW_TEXT_in_switchOption215);  
					stream_TEXT.add(t);

					// AST REWRITE
					// elements: 
					// token labels: 
					// rule labels: retval
					// token list labels: 
					// rule list labels: 
					// wildcard labels: 
					retval.tree = root_0;
					RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);

					root_0 = (CommonTree)adaptor.nil();
					// 327:61: ->
					{
						adaptor.addChild(root_0, new SwitchNode(t));
					}


					retval.tree = root_0;

					}
					break;
				case 6 :
					// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:328:3: {...}? =>t= TEXT '=' eText
					{
					if ( !((input.LT(1).getText().charAt(0) == 'D')) ) {
						throw new FailedPredicateException(input, "switchOption", "input.LT(1).getText().charAt(0) == 'D'");
					}
					t=(Token)match(input,TEXT,FOLLOW_TEXT_in_switchOption232);  
					stream_TEXT.add(t);

					char_literal7=(Token)match(input,9,FOLLOW_9_in_switchOption234);  
					stream_9.add(char_literal7);

					pushFollow(FOLLOW_eText_in_switchOption236);
					eText8=eText();
					state._fsp--;

					stream_eText.add(eText8.getTree());
					// AST REWRITE
					// elements: 
					// token labels: 
					// rule labels: retval
					// token list labels: 
					// rule list labels: 
					// wildcard labels: 
					retval.tree = root_0;
					RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);

					root_0 = (CommonTree)adaptor.nil();
					// 328:67: ->
					{
						adaptor.addChild(root_0, new UserPropertyNode(t, (eText8!=null?input.toString(eText8.start,eText8.stop):null), (t!=null?t.getCharPositionInLine():0)));
					}


					retval.tree = root_0;

					}
					break;
				case 7 :
					// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:329:3: {...}? =>t= TEXT
					{
					if ( !((isParamOption(input.LT(1).getText()))) ) {
						throw new FailedPredicateException(input, "switchOption", "isParamOption(input.LT(1).getText())");
					}
					t=(Token)match(input,TEXT,FOLLOW_TEXT_in_switchOption254);  
					stream_TEXT.add(t);

					index = t.getText().indexOf(':'); if (index > 0) {name=t.getText().substring(0,index); value = (index+1) == t.getText().length() ? "" : t.getText().substring(index+1);}
					// AST REWRITE
					// elements: 
					// token labels: 
					// rule labels: retval
					// token list labels: 
					// rule list labels: 
					// wildcard labels: 
					retval.tree = root_0;
					RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);

					root_0 = (CommonTree)adaptor.nil();
					// 329:227: ->
					{
						adaptor.addChild(root_0, new ParametrizedNode(t, name, ":", value));
					}


					retval.tree = root_0;

					}
					break;
				case 8 :
					// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:330:3: {...}? =>t= TEXT
					{
					if ( !((memOptions.matcher(input.LT(1).getText()).matches())) ) {
						throw new FailedPredicateException(input, "switchOption", "memOptions.matcher(input.LT(1).getText()).matches()");
					}
					t=(Token)match(input,TEXT,FOLLOW_TEXT_in_switchOption271);  
					stream_TEXT.add(t);

					// AST REWRITE
					// elements: 
					// token labels: 
					// rule labels: retval
					// token list labels: 
					// rule list labels: 
					// wildcard labels: 
					retval.tree = root_0;
					RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);

					root_0 = (CommonTree)adaptor.nil();
					// 330:69: ->
					{
						adaptor.addChild(root_0, new ParametrizedNode(t, 3));
					}


					retval.tree = root_0;

					}
					break;
				case 9 :
					// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:331:3: {...}? =>t= TEXT WS eText
					{
					if ( !((CLASSPATH.equals(input.LT(1).getText()) || CLASSPATH_LONG.equals(input.LT(1).getText()))) ) {
						throw new FailedPredicateException(input, "switchOption", "CLASSPATH.equals(input.LT(1).getText()) || CLASSPATH_LONG.equals(input.LT(1).getText())");
					}
					t=(Token)match(input,TEXT,FOLLOW_TEXT_in_switchOption288);  
					stream_TEXT.add(t);

					WS9=(Token)match(input,WS,FOLLOW_WS_in_switchOption290);  
					stream_WS.add(WS9);

					pushFollow(FOLLOW_eText_in_switchOption292);
					eText10=eText();
					state._fsp--;

					stream_eText.add(eText10.getTree());
					// AST REWRITE
					// elements: 
					// token labels: 
					// rule labels: retval
					// token list labels: 
					// rule list labels: 
					// wildcard labels: 
					retval.tree = root_0;
					RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);

					root_0 = (CommonTree)adaptor.nil();
					// 331:112: ->
					{
						adaptor.addChild(root_0, new ParametrizedNode(t, " ", (eText10!=null?input.toString(eText10.start,eText10.stop):null), false));
					}


					retval.tree = root_0;

					}
					break;
				case 10 :
					// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:332:3: t= TEXT
					{
					t=(Token)match(input,TEXT,FOLLOW_TEXT_in_switchOption304);  
					stream_TEXT.add(t);

					// AST REWRITE
					// elements: 
					// token labels: 
					// rule labels: retval
					// token list labels: 
					// rule list labels: 
					// wildcard labels: 
					retval.tree = root_0;
					RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);

					root_0 = (CommonTree)adaptor.nil();
					// 332:10: ->
					{
						adaptor.addChild(root_0, new UnrecognizedOption(t));
					}


					retval.tree = root_0;

					}
					break;

			}
			retval.stop = input.LT(-1);

			retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
			adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
			retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
		}
		finally {
			// do for sure before leaving
		}
		return retval;
	}
	// $ANTLR end "switchOption"


	public static class eText_return extends ParserRuleReturnScope {
		CommonTree tree;
		@Override
		public CommonTree getTree() { return tree; }
	};


	// $ANTLR start "eText"
	// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:334:1: eText : ( '\\'' TEXT '\\'' | '\"' TEXT '\"' | TEXT );
	public final CommandLineParser.eText_return eText() throws RecognitionException {
		CommandLineParser.eText_return retval = new CommandLineParser.eText_return();
		retval.start = input.LT(1);

		CommonTree root_0 = null;

		Token char_literal11=null;
		Token TEXT12=null;
		Token char_literal13=null;
		Token char_literal14=null;
		Token TEXT15=null;
		Token char_literal16=null;
		Token TEXT17=null;

		CommonTree char_literal11_tree=null;
		CommonTree TEXT12_tree=null;
		CommonTree char_literal13_tree=null;
		CommonTree char_literal14_tree=null;
		CommonTree TEXT15_tree=null;
		CommonTree char_literal16_tree=null;
		CommonTree TEXT17_tree=null;

		try {
			// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:334:7: ( '\\'' TEXT '\\'' | '\"' TEXT '\"' | TEXT )
			int alt6=3;
			switch ( input.LA(1) ) {
			case 10:
				{
				alt6=1;
				}
				break;
			case 7:
				{
				alt6=2;
				}
				break;
			case TEXT:
				{
				alt6=3;
				}
				break;
			default:
				NoViableAltException nvae =
					new NoViableAltException("", 6, 0, input);
				throw nvae;
			}
			switch (alt6) {
				case 1 :
					// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:335:3: '\\'' TEXT '\\''
					{
					root_0 = (CommonTree)adaptor.nil();


					char_literal11=(Token)match(input,10,FOLLOW_10_in_eText318); 
					char_literal11_tree = (CommonTree)adaptor.create(char_literal11);
					adaptor.addChild(root_0, char_literal11_tree);

					TEXT12=(Token)match(input,TEXT,FOLLOW_TEXT_in_eText320); 
					TEXT12_tree = (CommonTree)adaptor.create(TEXT12);
					adaptor.addChild(root_0, TEXT12_tree);

					char_literal13=(Token)match(input,10,FOLLOW_10_in_eText322); 
					char_literal13_tree = (CommonTree)adaptor.create(char_literal13);
					adaptor.addChild(root_0, char_literal13_tree);

					}
					break;
				case 2 :
					// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:336:4: '\"' TEXT '\"'
					{
					root_0 = (CommonTree)adaptor.nil();


					char_literal14=(Token)match(input,7,FOLLOW_7_in_eText327); 
					char_literal14_tree = (CommonTree)adaptor.create(char_literal14);
					adaptor.addChild(root_0, char_literal14_tree);

					TEXT15=(Token)match(input,TEXT,FOLLOW_TEXT_in_eText329); 
					TEXT15_tree = (CommonTree)adaptor.create(TEXT15);
					adaptor.addChild(root_0, TEXT15_tree);

					char_literal16=(Token)match(input,7,FOLLOW_7_in_eText332); 
					char_literal16_tree = (CommonTree)adaptor.create(char_literal16);
					adaptor.addChild(root_0, char_literal16_tree);

					}
					break;
				case 3 :
					// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:337:8: TEXT
					{
					root_0 = (CommonTree)adaptor.nil();


					TEXT17=(Token)match(input,TEXT,FOLLOW_TEXT_in_eText341); 
					TEXT17_tree = (CommonTree)adaptor.create(TEXT17);
					adaptor.addChild(root_0, TEXT17_tree);

					}
					break;

			}
			retval.stop = input.LT(-1);

			retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
			adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
			retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
		}
		finally {
			// do for sure before leaving
		}
		return retval;
	}
	// $ANTLR end "eText"


	public static class nonSwitchOption_return extends ParserRuleReturnScope {
		CommonTree tree;
		@Override
		public CommonTree getTree() { return tree; }
	};


	// $ANTLR start "nonSwitchOption"
	// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:339:1: nonSwitchOption : t= TEXT ->;
	public final CommandLineParser.nonSwitchOption_return nonSwitchOption() throws RecognitionException {
		CommandLineParser.nonSwitchOption_return retval = new CommandLineParser.nonSwitchOption_return();
		retval.start = input.LT(1);

		CommonTree root_0 = null;

		Token t=null;

		CommonTree t_tree=null;
		RewriteRuleTokenStream stream_TEXT=new RewriteRuleTokenStream(adaptor,"token TEXT");

		try {
			// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:340:2: (t= TEXT ->)
			// /home/matthias/src/netbeans/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/vmo/gen/CommandLine.g:340:4: t= TEXT
			{
			t=(Token)match(input,TEXT,FOLLOW_TEXT_in_nonSwitchOption352);  
			stream_TEXT.add(t);

			// AST REWRITE
			// elements: 
			// token labels: 
			// rule labels: retval
			// token list labels: 
			// rule list labels: 
			// wildcard labels: 
			retval.tree = root_0;
			RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);

			root_0 = (CommonTree)adaptor.nil();
			// 340:11: ->
			{
				adaptor.addChild(root_0, new UnknownOption(t));
			}


			retval.tree = root_0;

			}

			retval.stop = input.LT(-1);

			retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
			adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
			retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
		}
		finally {
			// do for sure before leaving
		}
		return retval;
	}
	// $ANTLR end "nonSwitchOption"

	// Delegated rules



	public static final BitSet FOLLOW_WS_in_vmOptions77 = new BitSet(new long[]{0x0000000000000120L});
	public static final BitSet FOLLOW_option_in_vmOptions79 = new BitSet(new long[]{0x0000000000000162L});
	public static final BitSet FOLLOW_WS_in_vmOptions82 = new BitSet(new long[]{0x0000000000000002L});
	public static final BitSet FOLLOW_8_in_option96 = new BitSet(new long[]{0x0000000000000020L});
	public static final BitSet FOLLOW_switchOption_in_option98 = new BitSet(new long[]{0x0000000000000002L});
	public static final BitSet FOLLOW_nonSwitchOption_in_option108 = new BitSet(new long[]{0x0000000000000002L});
	public static final BitSet FOLLOW_TEXT_in_switchOption132 = new BitSet(new long[]{0x0000000000000002L});
	public static final BitSet FOLLOW_TEXT_in_switchOption163 = new BitSet(new long[]{0x0000000000000002L});
	public static final BitSet FOLLOW_TEXT_in_switchOption183 = new BitSet(new long[]{0x0000000000000002L});
	public static final BitSet FOLLOW_TEXT_in_switchOption200 = new BitSet(new long[]{0x0000000000000002L});
	public static final BitSet FOLLOW_TEXT_in_switchOption215 = new BitSet(new long[]{0x0000000000000002L});
	public static final BitSet FOLLOW_TEXT_in_switchOption232 = new BitSet(new long[]{0x0000000000000200L});
	public static final BitSet FOLLOW_9_in_switchOption234 = new BitSet(new long[]{0x00000000000004A0L});
	public static final BitSet FOLLOW_eText_in_switchOption236 = new BitSet(new long[]{0x0000000000000002L});
	public static final BitSet FOLLOW_TEXT_in_switchOption254 = new BitSet(new long[]{0x0000000000000002L});
	public static final BitSet FOLLOW_TEXT_in_switchOption271 = new BitSet(new long[]{0x0000000000000002L});
	public static final BitSet FOLLOW_TEXT_in_switchOption288 = new BitSet(new long[]{0x0000000000000040L});
	public static final BitSet FOLLOW_WS_in_switchOption290 = new BitSet(new long[]{0x00000000000004A0L});
	public static final BitSet FOLLOW_eText_in_switchOption292 = new BitSet(new long[]{0x0000000000000002L});
	public static final BitSet FOLLOW_TEXT_in_switchOption304 = new BitSet(new long[]{0x0000000000000002L});
	public static final BitSet FOLLOW_10_in_eText318 = new BitSet(new long[]{0x0000000000000020L});
	public static final BitSet FOLLOW_TEXT_in_eText320 = new BitSet(new long[]{0x0000000000000400L});
	public static final BitSet FOLLOW_10_in_eText322 = new BitSet(new long[]{0x0000000000000002L});
	public static final BitSet FOLLOW_7_in_eText327 = new BitSet(new long[]{0x0000000000000020L});
	public static final BitSet FOLLOW_TEXT_in_eText329 = new BitSet(new long[]{0x0000000000000080L});
	public static final BitSet FOLLOW_7_in_eText332 = new BitSet(new long[]{0x0000000000000002L});
	public static final BitSet FOLLOW_TEXT_in_eText341 = new BitSet(new long[]{0x0000000000000002L});
	public static final BitSet FOLLOW_TEXT_in_nonSwitchOption352 = new BitSet(new long[]{0x0000000000000002L});
}
